package com.news.news.service;


import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.news.news.dao.UserDao;
import com.news.news.modle.Admin;
import com.news.news.modle.User;
import com.news.news.util.JWTUtil;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.ArrayList;

@Service
@Transactional
public class UsersService {
    @Resource
    UserDao userDao;
    public PageInfo<User> usersList(User user) {
//
        PageHelper.startPage(user.getPageNum(),user.getPageSize());
        ArrayList<User> users = userDao.userList(user);
        PageInfo<User> pageInfo = new PageInfo<>(users);
        return pageInfo;
    }


    public void changeState(User user) {
        userDao.changeState(user);
    }

    public void deleteUser(Integer id) {
        userDao.deleteUser(id);
    }


}
